/* ---------- Base / Theme ---------- */
:root {
  --bg: #f9fafb;
  --fg: #1f2937;
  --accent: #2563eb;
  --accent-light: #dbeafe;
  --border: #e5e7eb;
  --border-strong: #9ca3af;
  --row-alt: #f3f4f6;
  --row-hover: #e0e7ff;
  --shadow-1: 0 7px 8px -4px rgba(0,0,0,.1),0 12px 17px 2px rgba(0,0,0,.06),0 5px 22px 4px rgba(0,0,0,.04);
  --font-main: "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111827;
    --fg: #e5e7eb;
    --accent: #60a5fa;
    --accent-light: #1e3a8a;
    --border: #374151;
    --border-strong: #6b7280;
    --row-alt: #1f2937;
    --row-hover: #374151;
    --shadow-1: 0 7px 8px -4px rgba(0,0,0,.6),0 12px 17px 2px rgba(0,0,0,.4),0 5px 22px 4px rgba(0,0,0,.3);
  }
}

/* Manual dark mode override */
html.dark-theme {
  --bg: #111827;
  --fg: #e5e7eb;
  --accent: #60a5fa;
  --accent-light: #1e3a8a;
  --border: #374151;
  --border-strong: #6b7280;
  --row-alt: #374151;
  --row-hover: #4b5563;
  --shadow-1: 0 7px 8px -4px rgba(0,0,0,.6),0 12px 17px 2px rgba(0,0,0,.4),0 5px 22px 4px rgba(0,0,0,.3);
}

/* Manual light mode override */
html.light-theme {
  --bg: #f9fafb;
  --fg: #1f2937;
  --accent: #2563eb;
  --accent-light: #dbeafe;
  --border: #e5e7eb;
  --border-strong: #9ca3af;
  --row-alt: #f3f4f6;
  --row-hover: #e0e7ff;
  --shadow-1: 0 7px 8px -4px rgba(0,0,0,.1),0 12px 17px 2px rgba(0,0,0,.06),0 5px 22px 4px rgba(0,0,0,.04);
}

/* ---------- Global ---------- */
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-main);
  font-size: 16px;
  line-height: 1.4;
}

body {
  padding-top: 76px; /* Account for fixed navbar */
}

.main-content {
  padding: 32px 16px 120px;
  max-width: 1400px;
  margin: 0 auto;
}

/* optional global link style */
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover,
a:focus {
  text-decoration: underline;
}

/* spacing breaker instead of <br> spam */
.section-space {
  height: 32px;
}

/* ---------- Table styles ---------- */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  box-shadow: var(--shadow-1);
  border-radius: 10px;
  background: white;
  margin-bottom: 2rem;
}
@media (prefers-color-scheme: dark) {
  .table-wrap { background: #1f2937; }
}
html.dark-theme .table-wrap { background: #1f2937; }
html.light-theme .table-wrap { background: white; }

/* Override Bootstrap table styles for better integration */
.table-wrap .table {
  margin-bottom: 0;
  font-size: 0.92rem;
}

.table-wrap .table caption {
  text-align: left;
  font-weight: 600;
  padding: 12px 16px 8px;
  color: var(--fg);
  caption-side: top;
}

.table-wrap .table thead th {
  background: var(--accent-light);
  color: var(--fg);
  border-bottom: 2px solid var(--border-strong);
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
}

.table-wrap .table tbody td {
  text-align: center;
  vertical-align: middle;
  word-break: break-word;
}

/* Dark mode overrides for Bootstrap tables */
html.dark-theme .table-wrap .table {
  --bs-table-bg: transparent;
  --bs-table-striped-bg: var(--row-alt);
  --bs-table-hover-bg: var(--row-hover);
  --bs-table-border-color: var(--border);
  --bs-table-color: var(--fg);
}

html.dark-theme .table-wrap .table tbody tr:nth-of-type(odd) {
  background-color: var(--row-alt) !important;
  color: #f3f4f6 !important;
}

html.dark-theme .table-wrap .table tbody tr:nth-of-type(even) {
  background-color: var(--bg) !important;
  color: #f3f4f6 !important;
}

html.dark-theme .table-wrap .table tbody tr:hover {
  background-color: var(--row-hover) !important;
  color: #f3f4f6 !important;
}

html.dark-theme .table-wrap .table tbody tr td {
  color: #f3f4f6 !important;
}

html.light-theme .table-wrap .table {
  --bs-table-bg: transparent;
  --bs-table-striped-bg: var(--row-alt);
  --bs-table-hover-bg: var(--row-hover);
  --bs-table-border-color: var(--border);
  --bs-table-color: var(--fg);
}

html.light-theme .table-wrap .table tbody tr:nth-of-type(odd) {
  background-color: var(--row-alt) !important;
  color: var(--fg) !important;
}

html.light-theme .table-wrap .table tbody tr:nth-of-type(even) {
  background-color: var(--bg) !important;
  color: var(--fg) !important;
}

html.light-theme .table-wrap .table tbody tr:hover {
  background-color: var(--row-hover) !important;
  color: var(--fg) !important;
}

.text-left { text-align:left; max-width:1400px; margin:0 auto 24px; }

/* ---------- Pills / badges ---------- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--accent-light);
  color: var(--accent);
}
.badge-gray {
  background: var(--border);
  color: var(--fg);
}

/* ---------- Small utilities ---------- */
.mono { font-family: var(--font-mono); font-size: 0.8rem; }
.right { text-align: right; }
.left { text-align: left; }
.nowrap { white-space: nowrap; }

/* ---------- Bootstrap Integration ---------- */
/* Navbar theme toggle button styling */
#theme-toggle {
  transition: all 0.3s ease;
}

#theme-toggle:hover {
  transform: scale(1.05);
}

.theme-toggle-icon {
  transition: transform 0.3s ease;
}

#theme-toggle:hover .theme-toggle-icon {
  transform: rotate(180deg);
}

/* DataTables customization */
.dataTables_wrapper {
  padding-top: 1rem;
}

.dataTables_filter {
  margin-bottom: 1rem;
}

.dataTables_length {
  margin-bottom: 1rem;
}

/* DataTables dark mode styling */
html.dark-theme .dataTables_wrapper .dataTables_length,
html.dark-theme .dataTables_wrapper .dataTables_filter,
html.dark-theme .dataTables_wrapper .dataTables_info,
html.dark-theme .dataTables_wrapper .dataTables_paginate {
  color: var(--fg) !important;
}

html.dark-theme .dataTables_wrapper .dataTables_length select,
html.dark-theme .dataTables_wrapper .dataTables_filter input {
  background-color: var(--bg) !important;
  color: var(--fg) !important;
  border-color: var(--border) !important;
}

html.dark-theme .dataTables_wrapper .dataTables_paginate .paginate_button {
  background-color: var(--bg) !important;
  color: var(--fg) !important;
  border-color: var(--border) !important;
}

html.dark-theme .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background-color: var(--row-hover) !important;
  color: var(--fg) !important;
}

html.dark-theme .dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background-color: var(--accent) !important;
  color: white !important;
}

/* Chart container improvements */
.chart-container {
  background: var(--bg);
  border-radius: 10px;
  padding: 1rem;
  box-shadow: var(--shadow-1);
  margin-bottom: 2rem;
}
